/* 
 * File:   svg_exception.cpp
 * Author: Satan
 * 
 * Created on September 9, 2012, 1:21 PM
 */

#include "svgloader/svg_exception.h"
#include <stdio.h>

svg_exception::svg_exception(long int errorcode, std::string errorstring) : engexeption(errorcode, errorstring)
{
    std::string error_teamplate;
    switch (errorcode)
    {
        case ENG_OBJECT_FILE_OPEN_ERROR:
            error_teamplate = ENG_OBJECT_FILE_OPEN_STR;
            break;
            
        case  ENG_OBJECT_FILE_WRONG_ERROR:
            error_teamplate = ENG_OBJECT_FILE_WRONG_STR;
            break;
            
        default:
            error_teamplate = "%s";
            break;
    };
    
    char *buffer;
    buffer = new char[error_teamplate.length() + errorstring.length()];
    
    sprintf(buffer, error_teamplate.c_str(), errorstring.c_str());
    
    m_errorstring = buffer;    
    delete[] buffer;
    
}

svg_exception::svg_exception(const svg_exception& orig) : engexeption(orig)
{
}

svg_exception::~svg_exception() 
{
}

